
@extends('layout.default')

@section('layout.breadcrumb')
  <div class="breadcrumbs breadcrumbs-fixed" id="breadcrumbs">
    <div class="dataTables_paginate paging_bootstrap">
      {{$products->links()}}
    </div>
    <div class="form-group">
      <div class="input-group" style="width:350px;">
          <input type="text" class="form-control" id="acco" name="acco" maxlength="13" placeholder="商品名称" autocomplete="off" value="">
          <span class="input-group-btn">
            <button class="btn btn-primary" id="btn-sign" type="submit" style="height:34px;">
            <i class="ace-icon fa fa-search"></i> 查询
            </button>
            <a href="{{route("merchant.product.create")}}" class="btn btn-inverse create-product" style="height:34px;">
              <i class="ace-icon fa fa-leaf"></i> 新增
            </a>
          </span>
      </div>
    </div>
  </div>
@stop

@section('layout.content')

<div class="row">

@foreach($products as $product)
  <div class="col-xs-6 col-sm-4 col-md-4 col-lg-1-5">

    <div class="thumbnail search-thumbnail" data-id="">

      <div class="thumb">
        <img class="img-responsive lazy" src="/assets/images/placehoder.png" data-original="{{$product->cover_pic}}" />
      </div>

      <div class="caption">
        <div class="content-line">
          <a href="{{route('merchant.product.edit',$product->id)}}" class="content-title" title="{{$product->title}}">{{$product->name}}{{$product->title}}</a>
        </div>
        <div class="content-line coupon-tags">
          <span class="coupon coupon-scope-4">无优惠券</span>
          {!! $product->present()->effectStatus !!}
        </div>

        <div class="shops">
          <div class="shops-lf">
            <span class="shops-price">￥{{$product->sale('price')}}</span>
            <span class="shops-original grey">{{$product->sale('origin')}}</span>
          </div>
          <div class="shops-rf">
            <span class="grey">销量 </span>
            <span class="grey">{{$product->itemsCount()}}</span>
          </div>
        </div>

        <div class="shops">
          <div class="shops-lf">
            <span class="blue">结算 </span>
            <span class="blue">{{$product->sale('settlement')}}</span>
          </div>
          <div class="shops-rf number">
            {!! $product->present()->saleStatus !!}
          </div>
        </div>

        <div class="shops">
          <div class="shop-name">{!! $product->shop->present()->shopTrade !!} {{$product->shop->name}}</div>
        </div>
      </div>

    </div>

  </div>
  @endforeach
</div>

<div class="row">
  <div class="col-xs-12">
    <div class="dataTables_paginate paging_bootstrap">
      {{$products->links()}}
    </div>
  </div>
</div>
@stop

@section('javascript')
<script src="//cdn.bootcdn.net/ajax/libs/jquery.lazyload/1.9.1/jquery.lazyload.min.js"></script>
<script type="text/javascript">

  $(function() {

    $('.create-product1').on('click', function() {
      var uri = '{{route("merchant.product.create")}}';
      layer.open({
          type: 2,
          title: '新增商品',
          area: ['1250px', '750px'],
          shade: 0.8,
          content: uri,
        });
    });


    $("img.lazy").lazyload({
      placehoder: "/assets/images/placehoder.png",
      effect: "fadeIn"
    });

  });



</script>
@stop